package com.shihan._01_multi_thread_basic.callable;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * @Description 实现 Callable 接口的线程类
 * @Author shihan
 * @Date 2021/8/8 17:06
 * @Version 1.0
 */
public class MyCallableThread implements Callable<Map<String, Object>> {

    @Override
    public Map<String, Object> call() throws Exception {
        System.out.println("call方法开始执行...");
        try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); }
        Map<String, Object> res = new HashMap<>();
        res.put("hello", "world");
        System.out.println("call方法执行结束...");
        return res;
    }

}
